﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CefSharp;
using System.Net;

namespace Citi.SecurityWebBrowser
{
    public class RequestHandler : IRequestHandler
    {
        private readonly string folderSave;

        public RequestHandler(string pathToDownload)
        {
            folderSave = pathToDownload;
        }

        bool IRequestHandler.OnBeforeBrowse(IWebBrowser browser, IRequest request, NavigationType naigationvType, bool isRedirect)
        {
            return false;
        }

        bool IRequestHandler.OnBeforeResourceLoad(IWebBrowser browser, IRequestResponse requestResponse)
        {
            IRequest request = requestResponse.Request;
            return false;
        }

        void IRequestHandler.OnResourceResponse(IWebBrowser browser, string url, int status, string statusText, string mimeType, WebHeaderCollection headers)
        {

        }

        bool IRequestHandler.GetDownloadHandler(IWebBrowser browser, out IDownloadHandler handler)
        {
            handler = new DownloadHandler(folderSave);
            return true;
        }

        bool IRequestHandler.GetAuthCredentials(IWebBrowser browser, bool isProxy, string host, int port, string realm, string scheme, ref string username, ref string password)
        {
            return false;
        }
    }
}
